package six;

import java.util.Date;

public class StopWatch {
    public static void main(String[] args) {
        StopWatch s = new StopWatch();
        s.start();
        int res=0;
        for(int i=1;i<=100000;i++){
            res++;        //代替选择排序测试时间
        }
        s.stop();
        s.getElapsedTime();

    }
    private long startTime, endTime;
    Date now;
    StopWatch(){
        now= new Date();
        startTime= now.getTime();

    }
    void stop(){
        now = new Date();
        endTime = now.getTime();

    }
    void start(){
        now= new Date();
        startTime= now.getTime();
    }
    void getElapsedTime(){
        System.out.println(endTime-startTime);
    }

}
